global keepers1979 ""


drop if v5==2

numlabel, add

genl yr=1979
global keepers1979 $keepers1979 yr

genl id=v1
global keepers1979 $keepers1979 id

genl income=v296
genl income3=income
centile income, c(33 66 100)
replace income3=0 if income<=r(c_1)
centile income, c(33 66 100)
replace income3=1 if income>r(c_1) & income<=r(c_2)
centile income, c(33 66 100)
replace income3=2 if income>r(c_2) & income<=r(c_3)
global keepers1979 $keepers1979 income3

genl pid_ce=(v191==44 & v192==1)
replace pid_ce=. if v190==.
global keepers1979 $keepers1979 pid_ce

gen pid_gov=pid_ce
global keepers1979 $keepers1979 pid_gov

genl vote_ce=v207
recode vote_ce 44=1 .=. else=0
global keepers1979 $keepers1979 vote_ce

genl vote_gov=vote_ce
global keepers1979 $keepers1979 vote_gov

drop if v2~=6


genl gpi=v45
recode gpi 8=2.5
replace gpi=abs(gpi-4)/3
global keepers1979 $keepers1979 gpi

genl socref=v182
recode socref 8=2.5
replace socref=abs(socref-4)/3
global keepers1979 $keepers1979 socref

genl degree=v256
recode degree 6=1 1/5 8=0
global keepers1979 $keepers1979 degree


// Class/occupation

gen class_resp_3cat = v218
recode class_resp_3cat 1/7=3 10/25=2 30/40=1 0=.
replace class_resp_3cat = . if class_resp_3cat > 40
label variable class_resp_3cat "Social class (3 cats.): higher value is higher class"
*label define LblClassGrade 1 "A: (Higher man.; prof." 2 "B: Lower man.; admin." 3 "C1A: Skilled; supervis. non-manu." 4 "C1B: Lower non-manu." 5 "C2: Skilled manu." 6 "D: Unskilled manu."
*label values class_head_grade LblClassGrade
global keepers1979 $keepers1979 class_resp_3cat

gen class_spou_3cat = v260
recode class_spou_3cat 1/7=3 10/25=2 30/40=1 0=.
replace class_spou_3cat = . if class_spou_3cat > 40
label variable class_spou_3cat "Social class (3 cats.): higher value is higher class"
*label define LblClassGrade 1 "A: (Higher man.; prof." 2 "B: Lower man.; admin." 3 "C1A: Skilled; supervis. non-manu." 4 "C1B: Lower non-manu." 5 "C2: Skilled manu." 6 "D: Unskilled manu."
*label values class_head_grade LblClassGrade
global keepers1979 $keepers1979 class_spou_3cat

gen class_reho_3cat_strata = v298
recode class_reho_3cat_strata 1=1 2=1 3=2 4=2 5=1 6=2 7=2 8=. 0=.
replace class_reho_3cat_strata = . if class_reho_3cat_strata > 40
label variable class_reho_3cat_strata "Social class (3 cats.): higher value is higher class"
*label define LblClassGrade 1 "A: (Higher man.; prof." 2 "B: Lower man.; admin." 3 "C1A: Skilled; supervis. non-manu." 4 "C1B: Lower non-manu." 5 "C2: Skilled manu." 6 "D: Unskilled manu."
*label values class_head_grade LblClassGrade
global keepers1979 $keepers1979 class_reho_3cat_strata


gen male = v288
recode male 1=1 2=0
global keepers1979 $keepers1979 male

gen married = v257
recode married 1=1 2/3=0 6=. 9=.
global keepers1979 $keepers1979 married

gen unionmem_resp = v236
recode unionmem_resp 1/4=1 5=0
global keepers1979 $keepers1979 unionmem_resp

*gen unionmem_spou = v259
*recode unionmem_spou 1/4=1 .=0
*global keepers1979 $keepers1979 unionmem_spou



// Pascal/SM moderators


    gen party_ID=. 
   replace party_ID=1 if v190==1 & v191==11
   replace party_ID=2 if v190==1 & v191==22
   replace party_ID=3 if v190==1 & v191==33
   replace party_ID=4 if v190==1 & v191==44
  
   replace party_ID=6 if v190==1 & v191==66
   replace party_ID=7 if v190==1 & v191==87

   replace party_ID=8 if v190==1 & v191==88
   
   replace party_ID=9 if v190==1 & v191==12
 
   replace party_ID=10 if v190==1 & v191==55
 
 replace party_ID=11 if v190==1 & v191==13
 replace party_ID=12 if v190==1 & v191==71
 replace party_ID=13 if v190==1 & v191==72
 replace party_ID=14 if v190==1 & v191==73
replace party_ID=15 if v190==1 & v191==82
replace party_ID=16 if v190==1 & v191==14
replace party_ID=17 if v190==1 & v191==15


 lab def party_ID 1 "v�nsterpartiet kom " 2 "socialdemokraterna" 3"centerpartiet" 4"folkpartiet" 5"h�gerpartiet" 6"kristen demokratis" 7 "other" 8 "will not answer"9 " kommunistiska f�rbundet marxist-len" 10 " moderata samlingspartiet " 11 "sveriges kommunis" 12 "borgerligt "  13 "FC+C" 14 "lokal borgerlig" 15 "sk�nepartiet" 16 "kommunistiska arbetaref�rbundet" 17 "vpk, apk, kpmlr, skp, kaf" 18 "gr�nt parti" 19 "ny demokrati"
 lab val party_ID party_ID
  tab party_ID, m
 tab party_ID v191, m


 foreach var of varlist  v134 v136 v139 v140 v141{
        gen Z`var'=`var'
		replace Z`var'=5 if `var'==1
		replace Z`var'=4 if `var'==2
		replace Z`var'=3 if `var'==8 | `var'==3
		replace Z`var'=2 if `var'==4
		replace Z`var'=1 if `var'==5
		replace Z`var'=(Z`var'-1)/4
		tab Z`var' `var', m
  }

rename Zv134 daycare
lab var daycare "1=good idea to build more day care" 

rename Zv136 reduce_control
lab var reduce_control "1=good idea to reduce gov influence on enterprises" 

rename Zv139 socialize
lab var socialize "1=good idea to socialize large industries" 

rename Zv140 red_tax_high
lab var red_tax_high "1=good idea to cut taxes on high incomes" 

rename Zv141 transfer
lab var transfer "1=good idea to transfer business profit to union funds"

    foreach var of varlist v181{
        gen Z`var'=`var'
		replace Z`var'=1 if `var'==4
		replace Z`var'=2 if `var'==3
		replace Z`var'=2.5 if `var'==8
		replace Z`var'=3 if `var'==2
		replace Z`var'=4 if `var'==1
		replace Z`var'=(Z`var'-1)/3
		tab Z`var' `var', m
  }



    rename Zv181 econ_control
  lab var  econ_control "1=agree state control limit bank and industry influence"

gen transfer2=.
replace transfer2=1 if v170==1
replace transfer2=0.5 if v170==3 | v170==8
replace transfer2=0 if v170==5
lab var transfer2 "1=favor transfer business profit to union funds"
tab transfer2 v170, m


  gen right=v201/10
replace right=0.50 if right>1 & right~=.
  tab right
  lab var right "1=far right"

   gen talk_politic_outfamily=.
 replace talk_politic_outfamily=1 if v186==1
 replace talk_politic_outfamily=0.5 if v186==2 | v186==8
 replace talk_politic_outfamily=0 if v186==3
 tab v186 talk_politic_outfamily, m
 
 lab var talk_politic_outfamily "1=often talk politic outside family" 


  gen newspaper_politics=.
 replace newspaper_politics=0 if v27==1
 replace newspaper_politics=0.33 if v27==2
 replace newspaper_politics=0.66 if v27==3
 replace newspaper_politics=1 if v27==4
  replace newspaper_politics=0.5 if v27==8
tab newspaper_politics v27,m
	

 lab var newspaper_politics "1=read more politic articles"

 
 
gen anti_econ_control=.
replace anti_econ_control=0.3333333 if econ_control>0.5 & econ_control<1
replace anti_econ_control=0.6666666 if econ_control>0 & econ_control<0.5
replace anti_econ_control=1 if econ_control==0
replace anti_econ_control=0.5 if econ_control==0.5
replace anti_econ_control=0 if econ_control==1
tab anti_econ_control econ_control, m



gen anti_socialize=.
replace anti_socialize=0 if socialize==1
replace anti_socialize=0.25 if socialize==0.75
replace anti_socialize=0.5 if socialize==0.5
replace anti_socialize=0.75 if socialize==0.25
replace anti_socialize=1 if socialize==0
tab anti_socialize socialize, m

gen anti_transfer =.
replace anti_transfer =0 if transfer ==1
replace anti_transfer =0.25 if transfer ==0.75
replace anti_transfer =0.5 if transfer ==0.5
replace anti_transfer =0.75 if transfer ==0.25
replace anti_transfer =1 if transfer ==0
tab anti_transfer  transfer , m


gen anti_transfer2=.
replace anti_transfer2=0 if transfer2==1
replace anti_transfer2=0.5 if transfer2==0.5
replace anti_transfer2=1 if transfer2==0
tab anti_transfer2 transfer2, m

gen index_interest=( gpi+ talk_politic_outfamily +newspaper_politics  )/3
global keepers1979 $keepers1979 index_interest

gen index_market_oriented=(socref+anti_econ_control+ anti_socialize+ anti_transfer+ anti_transfer2 +right)/6
global keepers1979 $keepers1979 index_market_oriented
